﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework;

namespace ConjureBivouac2012.Object
{
    public class HealthIncrease : AbstractPowerUp
    {
        private int _increase = 2;

        public HealthIncrease(int increase) : base()
        {
            timeLife = 15;
            _increase = increase;
            this.setVelocity(Vector2.Zero);
            this.SetDirection(Vector2.Zero);
            animationDelay = 100;
            animationCount = 0;
            sprite.Scale = 1.5f;
        }

        public override void ApplyEffect(Entity player)
        {
            if (player is AbstractPlayer)
            {
                ((AbstractPlayer) player).GetVehicule().IncreaseHealth(_increase);
            }

            this.destroyMe();
        }

        public override void Update(GameTime time)
        {
            if (time.TotalGameTime.TotalMilliseconds - lastTime.TotalMilliseconds > animationDelay)
            {
                animationCount++;
                this.sprite.LoadContent(GameInfo.GetInstance().GetContent(), "power/LifeUp" + animationCount);
                animationCount %= 4;
                lastTime = time.TotalGameTime;
            }
            base.Update(time);
        }

        public override void LoadContent(Microsoft.Xna.Framework.Content.ContentManager contentManager)
        {
            sprite.LoadContent(contentManager, "power/LifeUp1");
            base.LoadContent(contentManager);
        }
    }
}
